home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / WINPROGS / IWF12.ZIP / KERNEL / KERNEL.H < prev   
Text File  |  1994-02-14  |  6KB  |  194 lines

  1. /*
  2. --------------------------------------------------------------------------
  3. KERNEL.H (Image Processing System Kernel header file)
  4.  
  5. AUTHOR:  Craig Muller 1991,1992,1993
  6.  
  7. Description:
  8.  
  9. This header file is designed for those modules which are system independent,
  10. that is they can be compiled for DOS or Windows Applications without any
  11. changes. DO NOT MODIFY THESE INCLUDES! otherwise they may loose
  12. compatibility with the rest of the system.
  13.  
  14. This file includes the general equates used for all of the image processing
  15. code in part two of Craig Lindley's book 'Practical Image Processing in C'.
  16. --------------------------------------------------------------------------
  17. */
  18. #if !defined( KERNEL_H )               // Prevent multiple includes
  19.  
  20. #define KERNEL_H
  21.  
  22. #define  PI      3.14159
  23. #define  TRUE        1
  24. #define  FALSE       0
  25.  
  26. #define  VIDEO    0x10
  27. #define  MAXW      1024                // Maximum image width in pixels
  28. #define  MAXH      1024                // Maximum image height in pixels
  29.  
  30. // Backward compatibility defines for older versions of IWF
  31. #define  FB       IMAGE
  32.  
  33. // Common Macros
  34. #define  MK_HPIMAGE(image,hp,x,y)  (BYTE huge *)(hp+(DWORD)(image->vres-1-y)*image->scansize+x)
  35. #define  MIN(a,b) ((a)>(b)) ? (b):(a)
  36. #define  MAX(a,b) ((a)>(b)) ? (a):(b)
  37. #define  SQUARE(x) (x)*(x)
  38.  
  39.  
  40. // The following code is unique to windows programs developed using this library.
  41.  
  42. #if !defined(__WINDOWS_H)
  43.  
  44. #ifndef __BOOL
  45.     #define __BOOL
  46.     typedef int BOOL;
  47. #endif
  48.  
  49. #ifndef __BYTE
  50.    #define __BYTE
  51.    typedef unsigned char BYTE;
  52. #endif
  53.  
  54. #ifndef __WORD
  55.    #define __WORD
  56.    typedef unsigned WORD;
  57. #endif
  58.  
  59. #ifndef __DWORD
  60.    #define __DWORD
  61.    typedef unsigned long DWORD;
  62. #endif
  63.  
  64. typedef struct tagPOINT
  65.   {
  66.   int x;
  67.   int y;
  68.   } POINT;
  69.  
  70. typedef struct tagRECT
  71.   {
  72.      int  left;
  73.      int  top;
  74.      int  right;
  75.      int  bottom;
  76.   } RECT;
  77.  
  78. #endif
  79.  
  80.  
  81. //-------------------------------------
  82. // Image file profile structure
  83. //-------------------------------------
  84. typedef struct tag_profile
  85.     {
  86.     int hsize;
  87.     int width;
  88.     int height;
  89.     int depth;
  90.  
  91.     } PROFILE;
  92.  
  93. //-------------------------------------
  94. // Image data structure
  95. //-------------------------------------
  96. typedef struct tag_IMAGE                         // Image structure
  97.    {
  98.    char fspec[80];                               // File path specifier
  99.    char comment[80];                             // Comments about the image
  100.  
  101.    int encode;                                   // Compression flag
  102.    int color;                                    // Color palette flag
  103.    int scansize;                                 // # bytes per scan line
  104.    int palsize;                                  // Palette size
  105.    int hres;                                     // Hres of image        
  106.    int vres;                                     // Vres of image        
  107.     int depth;                                    // Pixel depth
  108.  
  109.     float gamma;                                  // Gamma value
  110.  
  111.    RECT    rc;                                   // Processing rectangle
  112.    HANDLE  hData;                                // Handle to pixel data  
  113.     WORD    ILUT[256];                            // Input lookup table
  114.  
  115.     PALETTEENTRY Pal[256];                        // Base palette data
  116.     PALETTEENTRY LUT[256];                        // Display Look Up Table data
  117.     } IMAGE;
  118.  
  119. typedef struct tag_filter
  120.    {
  121.    char name[20];
  122.    int  width;
  123.    int  height;
  124.    int  divisor;
  125.    int  scale;
  126.    int  absolute;
  127.    int  data[3][3];
  128.    } FILTER;
  129.  
  130.  
  131. //--------------------------------------------------------------------------
  132. // Global function declarations.
  133. //--------------------------------------------------------------------------
  134.  
  135. // Image input and output functions (IMAGEIO.C)
  136. IMAGE *CreateImage(int hres,int vres);
  137. IMAGE *DestroyImage(IMAGE *image);
  138. IMAGE *MirrorImage(IMAGE *origin);
  139. IMAGE *FlipImage  (IMAGE *origin);
  140. IMAGE *ReduceImage(IMAGE *image,int reduction);
  141. IMAGE *ScaleImage (IMAGE *origin,int w,int h);
  142. IMAGE *RotateImage(IMAGE *origin,int dir);
  143. IMAGE *DuplicateImage(IMAGE *fb_old);
  144. void ClearImage   (IMAGE *image);
  145. void CopyImageData(IMAGE *image_src,IMAGE *image_dst);
  146. void CopyImagePal (IMAGE *fbsrc,IMAGE *fbdst);
  147. int  GetImagePixel(IMAGE *image,int x,int y,BYTE *dn);
  148. int  SetImagePixel(IMAGE *image,int x,int y,BYTE  dn);
  149. int  GetImageScan (IMAGE *image,int y,BYTE *dn);
  150. int  GetImageRow  (IMAGE *image,int x,int y,BYTE *dn,int cb);
  151. int  PutImageRow  (IMAGE *image,int x,int y,BYTE *dn,int cb);
  152. int  SetImageRow  (IMAGE *image,int x,int y,int Length,BYTE  dn);
  153. int  GetImageCol  (IMAGE *image,int x,int y,BYTE *dn,int cb);
  154. int  PutImageCol  (IMAGE *image,int x,int y,BYTE *dn,int cb);
  155. int  SetImageCol  (IMAGE *image,int x,int y,int Length,BYTE  dn);
  156. int  GetImageRect (IMAGE *image,RECT *r,BYTE *buf);
  157. int  PutImageRect (IMAGE *image,RECT *r,BYTE *buf);
  158. int  SetImageRect (IMAGE *image,RECT *r,BYTE dn);
  159.  
  160. // Image file loading and saving procedures
  161. IMAGE *LoadMTX(char *fspec);
  162. IMAGE *LoadPIC(char *fspec);
  163. IMAGE *LoadPCX(char *fspec);
  164. IMAGE *LoadIMG(char *fspec);
  165. IMAGE *LoadFTS(char *fspec,int pshift);
  166. IMAGE *LoadSBI(char *fspec,int pshift);
  167. IMAGE *LoadUSR(char *fspec,int hsize,int width,int height,int depth,int pshift);
  168. int  SaveMTX(IMAGE *image,char *fspec);
  169. int  PCXSave(IMAGE *image,char *fspec);
  170.  
  171. // Image area operations (AREA.C)
  172. int  FBArMedian    (IMAGE *image_src,RECT *r,WORD NeighCols,WORD NeighRows,IMAGE *image_dst);
  173. int  FBArSobelEdge (IMAGE *image_src,RECT *r,WORD Threshold,BOOL Overlay,IMAGE *image_dst);
  174.  
  175. // MATROX Data transfer functions.
  176. int im_PasteFromMem(BYTE huge *hpData,int fbx);
  177. int im_CopyToMem(int fbx,BYTE huge *hpData);
  178.  
  179. // MATROX Frame buffer functions.
  180. void im_getraster(int fbx,int y,BYTE far *raster);
  181. void im_getpixel (int fbx,int x,int y,WORD *dn);
  182. void im_setpixel (int fbx,int x,int y,WORD dn);
  183. void im_getrow   (int fbx,int x,int y,int cb,BYTE far *colbuf);
  184. void im_getcol   (int fbx,int x,int y,int cb,BYTE far *colbuf);
  185. void im_View     (int fbx);
  186. void im_Rectangle(int fbx,int x0, int y0, int w, int h);
  187.  
  188. // MATROX Lookup Table operations.
  189. int LUTXColorOverlay(void);
  190. int LUTXLoad();
  191.  
  192. #endif
  193.  
  194.